﻿using System;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace MovieStorage
{
    // Pokus se pridava novejsi datastore je treba: aktualizovat vsechny vyskyty soucasneho, krome trid importujicich ze starsich verzi
    // Potreba doplnit nove polozky do "MediaTemplate", "Form1" (nekolik vyskytu), "MultiopenForm", "FindAllForm", "ExportForm" a implementaci exporteru
    [Serializable]
    public class MovieDataStore12 : ICloneable //Aktualni datastore
    {
        public Int64 uniqueId { get; set; }
        public String czechName { get; set; }
        public String originalName { get; set; }
        public String link { get; set; }
        //public String imdbLink { get; set; }
        public String fileName { get; set; }
        public String mainGenre { get; set; }
        public List<Int32> otherGenre { get; set; }
        public String myRating { get; set; }
        public String csfdRating { get; set; }
        public String imdbRating { get; set; }
        public String movieNotes { get; set; }
        public String medium { get; set; }
        public String quality { get; set; }
        public String compression { get; set; }
        public String container { get; set; }
        public String resolution { get; set; }
        public String size { get; set; }
        public String mediumNotes { get; set; }
        public String language { get; set; }
        public String channelCount { get; set; }
        public DateTime timeOfAddtion { get; set; }
        public String pictureData { get; set; }
        public String pictureLink { get; set; }
        public String year { get; set; }
        public String length { get; set; }
        public String country { get; set; }
        public String directorName { get; set; }
        public String directorLink { get; set; }
        public SerializableDictionary<String, String> actors { get; set; } // jmeno = link
        public String recenze { get; set; }

        public MovieDataStore12()
        {
            czechName = "";
            originalName = "";
            link = "";
            fileName = "";
            mainGenre = "";
            otherGenre = new List<int>();
            myRating = "";
            csfdRating = "";
            imdbRating = "";
            movieNotes = "";
            medium = "";
            quality = "";
            compression = "";
            container = "";
            size = "";
            resolution = "";
            mediumNotes = "";
            language = "";
            channelCount = "";
            pictureData = "";
            pictureLink = "";
            timeOfAddtion = DateTime.Now;

            year = "";
            length = "";
            country = "";
            directorName = "";
            directorLink = "";
            actors = new SerializableDictionary<string, string>();
            recenze = "";
        }



        public override bool Equals(object o)
        {
            bool b = true;

            if ((o != null) && (o is MovieDataStore12))
            {
                MovieDataStore12 filmData = (MovieDataStore12)o;

                if (!filmData.czechName.Equals(this.czechName)) return false;
                if (!filmData.originalName.Equals(this.originalName)) return false;
                if (!filmData.link.Equals(this.link)) return false;
                if (!filmData.fileName.Equals(this.fileName)) return false;
                if (!filmData.mainGenre.Equals(this.mainGenre)) return false;
                if (!filmData.otherGenre.Equals(this.otherGenre)) return false;
                if (!filmData.myRating.Equals(this.myRating)) return false;
                if (!filmData.csfdRating.Equals(this.csfdRating)) return false;
                if (!filmData.imdbRating.Equals(this.imdbRating)) return false;
                if (!filmData.movieNotes.Equals(this.movieNotes)) return false;
                if (!filmData.medium.Equals(this.medium)) return false;
                if (!filmData.quality.Equals(this.quality)) return false;
                if (!filmData.compression.Equals(this.compression)) return false;
                if (!filmData.container.Equals(this.container)) return false;
                if (!filmData.size.Equals(this.size)) return false;
                if (!filmData.resolution.Equals(this.resolution)) return false;
                if (!filmData.mediumNotes.Equals(this.mediumNotes)) return false;
                if (!filmData.language.Equals(this.language)) return false;
                if (!filmData.channelCount.Equals(this.channelCount)) return false;
                if (!filmData.timeOfAddtion.Equals(this.timeOfAddtion)) return false;
                if (!filmData.pictureLink.Equals(this.pictureLink)) return false;

                if (!filmData.year.Equals(this.year)) return false;
                if (!filmData.length.Equals(this.length)) return false;
                if (!filmData.country.Equals(this.country)) return false;
                if (!filmData.directorName.Equals(this.directorName)) return false;
                if (!filmData.directorLink.Equals(this.directorLink)) return false;
                if (!filmData.actors.Equals(this.actors)) return false;
                if (!filmData.recenze.Equals(this.recenze)) return false;                
            }
            else
            {
                b = false;
            }

            return b;
        }

        public override Int32 GetHashCode()
        {
            return this.czechName.GetHashCode();
        }

        #region ICloneable Members

        public object Clone()
        {
            MovieDataStore12 clone = new MovieDataStore12();
            clone.czechName = this.czechName;
            clone.originalName = this.originalName;
            clone.link = this.link;
            //clone.imdbLink = this.imdbLink;
            clone.fileName = this.fileName;
            clone.mainGenre = this.mainGenre;
            clone.otherGenre = new List<int>();
            clone.otherGenre.AddRange(this.otherGenre);
            clone.myRating = this.myRating;
            clone.csfdRating = this.csfdRating;
            clone.imdbRating = this.imdbRating;
            clone.movieNotes = this.movieNotes;
            clone.medium = this.medium;
            clone.quality = this.quality;
            clone.compression = this.compression;
            clone.container = this.container;
            clone.size = this.size;
            clone.resolution = this.resolution;
            clone.mediumNotes = this.mediumNotes;
            clone.language = this.language;
            clone.channelCount = this.channelCount;
            clone.timeOfAddtion = this.timeOfAddtion;
            clone.pictureLink = this.pictureLink;
            clone.pictureData = this.pictureData;
            clone.year = this.year;
            clone.length = this.length;
            clone.country = this.country;
            clone.directorName = this.directorName;
            clone.directorLink = this.directorLink;
            clone.actors = this.actors;
            clone.recenze = this.recenze;

            return clone;
        }

        #endregion
    }


    [Serializable]
    public class MovieDataStore
    {
        public Int64 uniqueId { get; set; }
        public String czechName { get; set; }
        public String originalName { get; set; }
        public String link { get; set; }
        //public String imdbLink { get; set; }
        public String fileName { get; set; }
        public String mainGenre { get; set; }
        public List<Int32> otherGenre { get; set; }
        public String myRating { get; set; }
        public String csfdRating { get; set; }
        public String imdbRating { get; set; }
        public String movieNotes { get; set; }
        public String medium { get; set; }
        public String quality { get; set; }
        public String compression { get; set; }
        public String container { get; set; }
        public String resolution { get; set; }
        public String size { get; set; }
        public String mediumNotes { get; set; }
        public String language { get; set; }
        public String channelCount { get; set; }
        public DateTime timeOfAddtion { get; set; }
        
        public MovieDataStore()
        {
            czechName = "";
            originalName = "";
            link = "";
            fileName = "";
            mainGenre = "";
            otherGenre = new List<int>();
            myRating = "";
            csfdRating = "";
            imdbRating = "";
            movieNotes = "";
            medium = "";
            quality = "";
            compression = "";
            container = "";
            size = "";
            resolution = "";
            mediumNotes = "";
            language = "";
            channelCount = "";
            timeOfAddtion = DateTime.Now;
        }
    }
}
